<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_Actionsapplication extends Application_Model_ModelAbstract
{

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_Idactions;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_ServicesIdservices;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_Url;

    /**
     * Database var type varchar(512)
     *
     * @var string
     */
    protected $_Nommenue;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IconeClsIdiconeCls;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Orderaff;


    /**
     * Parent relation fk_actionsapplication_services1
     *
     * @var Application_Model_Services
     */
    protected $_Services;

    /**
     * Parent relation fk_actionsapplication_iconeCls1
     *
     * @var Application_Model_Iconecls
     */
    protected $_Iconecls;


    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idactions'=>'Idactions',
            'services_idservices'=>'ServicesIdservices',
            'url'=>'Url',
            'nommenue'=>'Nommenue',
            'iconeCls_idiconeCls'=>'IconeClsIdiconeCls',
            'orderaff'=>'Orderaff',
        ));

        $this->setParentList(array(
            'FkActionsapplicationServices1'=> array(
                    'property' => 'Services',
                    'table_name' => 'Services',
                ),
            'FkActionsapplicationIconeCls1'=> array(
                    'property' => 'Iconecls',
                    'table_name' => 'Iconecls',
                ),
        ));

        $this->setDependentList(array(
        ));
    }

    /**
     * Sets column idactions
     *
     * @param string $data
     * @return Application_Model_Actionsapplication
     */
    public function setIdactions($data)
    {
        $this->_Idactions = $data;
        return $this;
    }

    /**
     * Gets column idactions
     *
     * @return string
     */
    public function getIdactions()
    {
        return $this->_Idactions;
    }

    /**
     * Sets column services_idservices
     *
     * @param string $data
     * @return Application_Model_Actionsapplication
     */
    public function setServicesIdservices($data)
    {
        $this->_ServicesIdservices = $data;
        return $this;
    }

    /**
     * Gets column services_idservices
     *
     * @return string
     */
    public function getServicesIdservices()
    {
        return $this->_ServicesIdservices;
    }

    /**
     * Sets column url
     *
     * @param text $data
     * @return Application_Model_Actionsapplication
     */
    public function setUrl($data)
    {
        $this->_Url = $data;
        return $this;
    }

    /**
     * Gets column url
     *
     * @return text
     */
    public function getUrl()
    {
        return $this->_Url;
    }

    /**
     * Sets column nommenue
     *
     * @param string $data
     * @return Application_Model_Actionsapplication
     */
    public function setNommenue($data)
    {
        $this->_Nommenue = $data;
        return $this;
    }

    /**
     * Gets column nommenue
     *
     * @return string
     */
    public function getNommenue()
    {
        return $this->_Nommenue;
    }

    /**
     * Sets column iconeCls_idiconeCls
     *
     * @param string $data
     * @return Application_Model_Actionsapplication
     */
    public function setIconeClsIdiconeCls($data)
    {
        $this->_IconeClsIdiconeCls = $data;
        return $this;
    }

    /**
     * Gets column iconeCls_idiconeCls
     *
     * @return string
     */
    public function getIconeClsIdiconeCls()
    {
        return $this->_IconeClsIdiconeCls;
    }

    /**
     * Sets column orderaff
     *
     * @param int $data
     * @return Application_Model_Actionsapplication
     */
    public function setOrderaff($data)
    {
        $this->_Orderaff = $data;
        return $this;
    }

    /**
     * Gets column orderaff
     *
     * @return int
     */
    public function getOrderaff()
    {
        return $this->_Orderaff;
    }

    /**
     * Sets parent relation ServicesIdservices
     *
     * @param Application_Model_Services $data
     * @return Application_Model_Actionsapplication
     */
    public function setServices(Application_Model_Services $data)
    {
        $this->_Services = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idservices'];
        }

        $this->setServicesIdservices($primary_key);

        return $this;
    }

    /**
     * Gets parent ServicesIdservices
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_Services
     */
    public function getServices($load = true)
    {
        if ($this->_Services === null && $load) {
            $this->getMapper()->loadRelated('FkActionsapplicationServices1', $this);
        }

        return $this->_Services;
    }

    /**
     * Sets parent relation IconeClsIdiconeCls
     *
     * @param Application_Model_Iconecls $data
     * @return Application_Model_Actionsapplication
     */
    public function setIconecls(Application_Model_Iconecls $data)
    {
        $this->_Iconecls = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idiconeCls'];
        }

        $this->setIconeClsIdiconeCls($primary_key);

        return $this;
    }

    /**
     * Gets parent IconeClsIdiconeCls
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_Iconecls
     */
    public function getIconecls($load = true)
    {
        if ($this->_Iconecls === null && $load) {
            $this->getMapper()->loadRelated('FkActionsapplicationIconeCls1', $this);
        }

        return $this->_Iconecls;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Actionsapplication
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Actionsapplication());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Actionsapplication::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdactions() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idactions = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdactions()));
    }
}
